<template>
  <view class="protocol-agree">
    <single-checkbox
      :checked="agree"
      title="我已阅读并同意"
      @update:checked="onAgree"
    />
    <base-protocol :show="show" :type="type" @update:show="onShow" />
  </view>
</template>
<script setup lang="ts">
import singleCheckbox from "@/components/form/singleCheckbox.vue";
import baseProtocol from "@/components/protocol/base.vue";
import type { ProtocolTypeEnum } from "@/utils";
import type { PropType } from "vue";
defineProps({
  agree: {
    type: Boolean,
    default: false,
  },
  show: {
    type: Boolean,
    default: false,
  },
  type: {
    type: String as PropType<ProtocolTypeEnum>,
    required: true,
  },
});

const emits = defineEmits(["update:agree", "update:show"]);

const onAgree = (status: boolean) => {
  emits("update:agree", status);
};

const onShow = (status: boolean) => {
  emits("update:show", status);
};
</script>
<style lang="scss" scoped>
.protocol-agree {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}
</style>
